package com.eaoa.uc.busorder.bo;

import com.eaoa.base.EABaseBusinessObject;
import com.eaoa.dao.bus.BusOrderDAO;
import com.eaoa.vo.bus.BusOrder;

public class BusOrderCommonUpdateBO extends EABaseBusinessObject{

	private static BusOrderDAO orderDAO = new BusOrderDAO();
	private BusOrder vo ;
	private int type ;
	
	public static final int UPDATE_CHARGE = 1;
	
	public BusOrderCommonUpdateBO(BusOrder vo , int type) {
		super();
		this.vo=vo;
		this.type=type;
	}

	@Override
	protected void performBusinessLogic() {
		BusOrder po =  (BusOrder)orderDAO.loadAndLock(vo.getOrderno());
		
		if(type == UPDATE_CHARGE ){
			po.setCharge(vo.getCharge());
			po.setChargedetail(vo.getChargedetail());
			po.setPay(vo.getPay());
			po.setPaydetail(vo.getPaydetail());
		}
		
		orderDAO.update(po);
	}
}
